package spring5.test;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import spring5.aopanno.User;
import spring5.config.ConfigAop;

/**
 * @BelongsProject: spring5_demos
 * @BelongsPackage: spring5.test
 * @Author: LiYing
 * @CreateTime: 2021-01-06 14:55
 * @Description:
 */
public class testAop {

    @Test
    public void testAopAnno1() {
        ApplicationContext context =
                new ClassPathXmlApplicationContext("bean1.xml");
        User user = context.getBean("user", User.class);
        user.add();
    }

    @Test
    public void testAopAnno2() {
        ApplicationContext context =
                new AnnotationConfigApplicationContext(ConfigAop.class);
        User user = context.getBean("user", User.class);
        user.add();
    }


}
